﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>
<title>全文检索-${web.title}</title>
<link href="/template/default/css/main.css" type="text/css" rel="stylesheet" media="screen and (min-width: 800px)" >
<link href="/template/default/css/main_m.css" type="text/css" rel="stylesheet" media="screen and (max-width: 800px)" >
<link href="/template/default/css/search.css" type="text/css" rel="stylesheet" media="screen and (min-width: 800px)" />
<link href="/template/default/css/search_m.css" type="text/css" rel="stylesheet" media="screen and (max-width: 800px)" />
<link href="/resource/css/grayscale.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/resource/js/jquery.js"></script>
<script type="text/javascript" src="/resource/js/grayscale.js"></script>
<script type="text/javascript" src="/template/default/js/main.js"></script>
</head>
	<#include "top.html">
    <div class="panel">
        <div class="middle" style="background:white">
            <h3>共搜索到<span>${recordcount}</span>条结果：</h3>
            <#if articles?size gt 0>
            	<form method="post" action="/search/">
            		<table cellspacing="0" cellpadding="5" border="0">
                        <#assign rate = 100>
                        <#list articles as article>
                            <tr>
                                <td>
                                	<a href="${getDetailLink(article)}" target="_blank" class="title">${article.title?replace(searchstr,"<span style='color:red'>" + searchstr + "</span>")}</a><br />
                                	<#if article.image??>
                                		<img src="${article.image}" width="120" height="75" />
                                	</#if>
                                	<#if article.contenttext??>
                                		<#assign description = "">
                                		<#if article.digest?? && article.digest?index_of(searchstr) lt -1><#assign description = article.digest><#else><#assign description = article.contenttext></#if>
                                		<#assign starindex = (description?index_of(searchstr) lt rate)?string(0,description?index_of(searchstr) - rate)?number>
                                		<#assign description = description?substring(starindex)>
                                    	<#assign length = (description?length lt rate + description?index_of(searchstr))?string(description?length,rate + description?index_of(searchstr))?number>
                                    	<#assign description = description?substring(0,length)>
                                		${description?replace(searchstr,"<span style='color:red'>" + searchstr + "</span>")}...
                                	</#if>
                                	<div class="clear">
	                                    <a href="${getDetailLink(article)}" target="_blank" class="urllink">${getDetailLink(article)}</a>&nbsp;
	                                    <span class="publishtime">${article.publishtime?string('yyyy-MM-dd HH:mm:ss')}</span>
                                    </div>
                                </td>
                            </tr>
                        </#list>
                    </table>
                    <br />
					<!-- 搜索分页 -->
                    <div class="pager">
                        共${recordcount}条数据
                        <#if pagecount gt 1>
                            <a<#if pageindex gt 1> onclick="setpage(this,1)"</#if>>首页</a>
                            <a<#if pageindex gt 1> onclick="setpage(this,${(pageindex == 1)?string(1,pageindex-1)})"</#if>>上一页</a>
                            <#assign pagestart = (pageindex lte 5 || pagecount lte 10)?string(1,((pagecount-pageindex lt 5)?string(pageindex-(8-(pagecount-pageindex)),pageindex-4)?number))?number>
                            <#assign pagelength = (pagecount-pageindex lt (8-(pageindex-pagestart)))?string(pagecount,pageindex+(8-(pageindex-pagestart)))?number>
                            <#list pagestart..pagelength as i>
                                <a<#if i != pageindex> onclick="setpage(this,${i})"<#else> class="pcs"</#if>">${i}</a>
                            </#list>
                            <a<#if pageindex lt pagecount> onclick="setpage(this,${(pageindex == pagecount)?string(pagecount,pageindex+1)})"</#if>>下一页</a>
                            <a<#if pageindex lt pagecount> onclick="setpage(this,${pagecount})"</#if>>尾页</a>
                        </#if>
                        共${pagecount}页
                        <input type="hidden" name="pageindex" id="pageindex" value="${pageindex}" />
                        <input type="hidden" name="searchstr" value="${searchstr}" />
                    </div>
            	</form>
			<#else>
				<br/><br/><br/><center><b>未搜索到相关数据</b></center><br/><br/><br/>
            </#if>
        </div>
        <#include "bottom.html">
    </div>
</body>
</html>
